from typing import List, Optional


class PreCanvasConfig(dict):
    width: int
    height: int
    fps: int


class PreTextStyle(dict):
    size: int
    bold: bool
    italic: bool
    underline: bool
    color: List[float]
    alpha: float
    align: int
    vertical: bool
    letter_spacing: int
    line_spacing: int


class PreTextBorder(dict):
    alpha: float
    color: List[int]
    width: int


class PreTextBackground(dict):
    color: str
    style: int
    alpha: float
    round_radius: float
    height: float
    width: float
    horizontal_offset: float
    vertical_offset: float


class PreAnimation(dict):
    type: str
    duration: Optional[int] = None


class PreTextAnimations(dict):
    intro: PreAnimation
    outro: PreAnimation
    loop: PreAnimation


class PreTextConfig(dict):
    text: str
    start_time: int
    duration: int
    style: PreTextStyle
    border: PreTextBorder
    background: PreTextBackground
    animations: PreTextAnimations


class PreCropSettings(dict):
    upper_left_x: float
    upper_left_y: float
    upper_right_x: float
    upper_right_y: float
    lower_left_x: float
    lower_left_y: float
    lower_right_x: float
    lower_right_y: float


class PreVideoMaterial(dict):
    path: str
    name: str
    crop_settings: PreCropSettings


class PreVideoTrack(dict):
    track_name: str
    start_time: int
    duration: int
    relative_index: int
    material: PreVideoMaterial


class PreVideoConfig(dict):
    video_materials: List[PreVideoTrack]


class PreTemplate(dict):
    canvas_config: PreCanvasConfig
    text_conf: PreTextConfig
    video_conf: PreVideoConfig
